package com.qianfeng.strategy.filter.impl;/***
 *                    .::::.
 *                  .::::::::.
 *                 :::::::::::  
 *             ..:::::::::::'   木马~
 *           '::::::::::::'       
 *             .::::::::::       
 *        '::::::::::::::..
 *             ..::::::::::::.
 *           ``::::::::::::::::
 *            ::::``:::::::::'        .:::.
 *           ::::'   ':::::'       .::::::::.
 *         .::::'      ::::     .:::::::'::::.
 *        .:::'       :::::  .:::::::::' ':::::.
 *       .::'        :::::.:::::::::'      ':::::.
 *      .::'         ::::::::::::::'         ``::::.
 *  ...:::           ::::::::::::'              ``::.
 * ```` ':.          ':::::::::'                  ::::..
 *                    '.:::::'                    ':'````..
 */

import com.qianfeng.smsplatform.common.model.Standard_Submit;
import com.qianfeng.strategy.dfa.SensitivewordFilter;
import com.qianfeng.strategy.filter.FilterChain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * @author ：zl
 * @date ：Created in 2021/7/18 17:56
 */
@Component
public class DirtyWordsFilter implements FilterChain {

    private SensitivewordFilter sensitivewordFilter;

    @Autowired
    public void setSensitivewordFilter(SensitivewordFilter sensitivewordFilter) {
        this.sensitivewordFilter = sensitivewordFilter;
    }
    /**
     * 处理短信,相当于以前web中的filter中的 doFilter方法
     *
     * @param standard_submit
     * @return 如果返回fasle代表拦截后续的操作, 返回true继续
     */
    @Override
    public boolean dealSms(Standard_Submit standard_submit) {
        Set<String> sensitiveWord = sensitivewordFilter.getSensitiveWord(standard_submit.getMessageContent());//获内容中敏感词的集合
        System.err.println(sensitiveWord);
        return true;
    }
}
